<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>

<h:form>
<h:dataTable binding="#{eventList.dataTable}" value="#{eventList.events}" var="event" headerClass="tableHeader" styleClass="dataTable" rowClasses="oddRow, evenRow">
	<h:column>
		<f:facet name="header">
			<h:outputText value="Data" />
		</f:facet>
		<h:outputText value="#{event.startDate}">
			<f:convertDateTime pattern="dd-MM-yyyy  HH:mm" />
		</h:outputText>
	</h:column>
	<h:column>
		<f:facet name="header">
			<h:outputText value="Rodzaj" />
		</f:facet>
		<h:outputText value="#{event.series.kind}" />
	</h:column>
	<h:column>
		<f:facet name="header">
			<h:outputText value="Deadline" />
		</f:facet>
		<h:selectBooleanCheckbox value="#{event.deadline}" />
	</h:column>
	<h:column>
		<f:facet name="header">
			<h:outputText value="Prowadzacy" />
		</f:facet>
		<h:outputText value="#{event.series.teacher.name}" />
	</h:column>
	<h:column>
		<f:facet name="header">
			<h:outputText value="Miejsce" />
		</f:facet>
		<h:outputText value="#{event.place}" />
	</h:column>
	<h:column>
		<f:facet name="header">
			<h:outputText value="Szczegoly" />
		</f:facet>
		<h:outputText value="#{event.description}" />
	</h:column>
	<h:column>
		<f:facet name="header">
			<h:outputText value="" />
		</f:facet>
		<h:commandButton  value="Pokaz" action="#{eventList.goToEventDetails}" />
		<h:commandButton value="Edytuj" action="#{eventList.editEventDetails}" rendered="#{currentUser.teacher}" />
	</h:column>
</h:dataTable>
<h:commandButton value="Dodaj nowe spotkanie" action="#{eventList.addEventDetails}" rendered="#{currentUser.teacher}" />
</h:form>